In the sensor such as the stroke sensor detecting the mechanical displacement, a shaft member transmitting the displacement of the measuring object is in contact with a sliding element receiver attached with a sliding element at inside of a case. As for the shape of the contact section of the shaft member and the sliding element receiver, for example those having a flat end face of the shaft member and the end face of the sliding member, or those having hemispherical end face of the shaft member and flat end face of the sliding element supporting member are proposed.